//
//  MMGuideCell.m
//  mmLottery
//
//  Created by Apple on 16/5/31.
//  Copyright © 2016年 itcast. All rights reserved.
//

#import "MMGuideCell.h"
#import "JASidePanelController.h"
#import "LeftViewController.h"
#import "HomeViewController.h"
#import "TestViewController.h"
#import "BaseNavController.h"
#import <AFNetworkActivityIndicatorManager.h>
#import "MMGuideController.h"

@implementation MMGuideCell

- (instancetype)initWithFrame:(CGRect)frame
{
    self = [super initWithFrame:frame];
    if (self) {
        
        // MARK: - 1.添加按钮,并且监听事件
        // 1.创建按钮
        UIButton *btn = [UIButton buttonWithType:UIButtonTypeCustom];
        // 2.设置图片
        [btn setImage:[UIImage imageNamed:@"btn_nor"] forState:UIControlStateNormal];
        // 3.调整大小
        [btn sizeToFit];
        NSLog(@"%@", NSStringFromCGSize(btn.bounds.size));
        
        btn.frame = CGRectMake(150, 400, 70, 30);
        
        
//         4.添加
        [self.contentView addSubview:btn];
        // 5.监听事件
        [btn addTarget:self action:@selector(btnClick) forControlEvents:UIControlEventTouchUpInside];
        
        // 6.赋值
        _experienceBtn = btn;
        
    }
    return self;
}

- (void)btnClick {

    //实例化侧滑控制器
    JASidePanelController * viewController = [[JASidePanelController alloc] init];
    
    //设置leftPanel
    viewController.leftPanel = [[LeftViewController alloc] init];
    
    //设置centerPanel
    
    
    HomeViewController * homeVc = [[HomeViewController alloc] init];

    
    viewController.centerPanel = [[BaseNavController alloc] initWithRootViewController:homeVc];
    
    //设置侧滑控制器为window的根控制器
    [UIApplication sharedApplication].keyWindow.rootViewController = viewController;
    
}

@end
